package cn.bdqn.web;

import cn.bdqn.entity.Users;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**跳转对应权限页面
 * @author 梁非凡
 * @date 2018/8/14 13:36
 */
@WebServlet("/Usertype")
public class UsertypeServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Users users = (Users) request.getSession().getAttribute("users");
        Integer typeid = users.getTypeid();
        if (typeid==2){
            //跳转到 普通会员页面
            request.getRequestDispatcher(request.getContextPath()+"/WEB-INF/roots.jsp").forward(request,response);
        }else {
            //跳转到管理员页面
           request.getRequestDispatcher(request.getContextPath()+"/WEB-INF/administrator.jsp").forward(request,response);
        }
    }
}
